# $Id: PKGBUILD 178838 2013-02-27 14:54:16Z thomas $
# Maintainer: Thomas Bächler <thomas@archlinux.org>

pkgname=intel-ucode
pkgver=20130222
pkgrel=1
pkgdesc="Microcode update files for Intel CPUs"
arch=('any')
url="http://downloadcenter.intel.com/SearchResult.aspx?lang=eng&keyword=%22microcode%22"
replaces=('microcode_ctl')
license=('custom')
source=(http://downloadmirror.intel.com/22508/eng/microcode-${pkgver}.tgz
        LICENSE
        intel-microcode2ucode.c)
sha256sums=('fd25bd9777fc3c3b11f01e9090a2d24f7650023c9ec74bbf9f43bffe1d9d01cc'
            '6983e83ec10c6467fb9101ea496e0443f0574c805907155118e2c9f0bbea97b6'
            'c51b1b1d8b4b28e7d5d007917c1e444af1a2ff04a9408aa9067c0e57d70164de')

build() {
  cd "$srcdir"
  gcc -Wall ${CFLAGS} -o intel-microcode2ucode intel-microcode2ucode.c
  ./intel-microcode2ucode ./microcode.dat
}

package() {
  cd "$srcdir"
  install -d -m755 "${pkgdir}"/usr/lib/firmware/intel-ucode/
  cp intel-ucode/* "${pkgdir}"/usr/lib/firmware/intel-ucode/
  install -D -m644 LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}
